<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class page2_detail_model extends Model
{
	var $start_segment = 3;
	var $item;
	
	function page2_detail_model()
	{
		parent::Model();
		
		global $CI;
	}

	function maxkey()
	{
		$this->db->select_max(PAGE_PAGE_ID);
		$q = $this->db->get_where(PAGE, array(PAGE_FRANCHISE_ID=>$this->admin_id()));
		$row = $q->row();
		return $row?($row->{PAGE_PAGE_ID}+1):1;
	}
	function gettitle($pid)
	{
		$this->db->select(PAGE_TITLE);
		$q = $this->db->get_where(PAGE, array(PAGE_FRANCHISE_ID=>$this->admin_id(),PAGE_PAGE_ID=>$pid));
		$row = $q->row();
		return $row?($row->{PAGE_TITLE}):0;
	}
	
	function admin_id()
	{
		global $CI;
		$a = $CI->session->userdata('admin_auth_logged');
		return $a['admin_id'];
	}
	
}

?>
